package tony.web.auth.redis

import java.time.Duration
import tony.core.utils.uuid
import tony.redis.RedisManager
import tony.web.auth.IAuthService

/**
 * RedisAuthService
 * @author tangli
 * @date 2025/09/09 09:35
 */
public class RedisAuthService(
    public val prefix: String,
    override val expiredIn: Duration,
) : IAuthService<String> {
    override fun token(params: String): String {
        val token = uuid()
        val tokenKey = "$prefix$token"
        RedisManager.values.set(tokenKey, params, expiredIn)
        return token
    }
}
